package src.week4.实验一;

import java.io.*;

import static src.week4.实验一.Test.InsertNode;
import static src.week4.实验一.Test.PrintLinkedList;
import static src.week4.实验一.Test.Size;

public class shuzuTest {
        public static void main(String[] args) throws IOException {
                shuzu sz = new shuzu();
                int nLiWenZhou = 0;
                sz.add(20);
                sz.add(17);
                sz.add(23);
                sz.add(20);
                sz.add(20);
                sz.add(18);
                sz.add(9);
                sz.add(30);
                sz.add(20);
                sz.add(11);
                sz.add(29);
                nLiWenZhou = sz.size();
                System.out.println(sz.toString());
                System.out.println("元素数目：" + nLiWenZhou);
                //读取1,2
                File file = new File("D://wz", "Fn.txt");
                Reader reader = null;
                try {
                        reader = new InputStreamReader(new FileInputStream(file));
                        int temp;
                        while ((temp = reader.read()) != -1) {
                                if (((char) temp) != '\n') {
                                        System.out.println("文件中的元素" + (char) temp);
                                }
                        }
                        reader.close();
                } catch (Exception e) {
                        e.printStackTrace();
                }
                //排序
                sz.sort(sz.number);
                System.out.println("排序后：");
                for (int num : sz.number) {
                        System.out.println(num + ",");}
                //插入1
                sz.insert(5, 1);
                System.out.println("插入1:" + sz);
                nLiWenZhou = sz.size();

                //插入2
                sz.insert(0, 2);
                System.out.println("插入2:" + sz);


                //删除1
                sz.delete(6);
                System.out.println("删除1:" + sz);


//                }
                }
        }

